package com.fr.report.script.function;

import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;
import com.fr.report.script.Primitive;
import com.fr.report.script.core.FArray;

public class REVERSEARRAY extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    if (paramArrayOfObject.length != 1)
      return Primitive.ERROR_VALUE;
    Object localObject = paramArrayOfObject[0];
    if (!(localObject instanceof FArray))
      return Primitive.ERROR_VALUE;
    FArray localFArray1 = (FArray)localObject;
    FArray localFArray2 = new FArray();
    for (int i = localFArray1.length(); i > 0; --i)
      localFArray2.add(localFArray1.elementAt(i - 1));
    return localFArray2;
  }

  public Function.Type getType()
  {
    return Function.ARRAY;
  }

  public String getCN()
  {
    return "REVERSEARRAY(array):返回数组array的倒序数组。\n示例：\nREVERSEARRAY([\"第一个\", \"第二个\", \"第三个\"])返回[\"第三个\", \"第二个\", \"第一个\"].";
  }

  public String getEN()
  {
    return "";
  }
}